<div id="content" class="testd"><br>
<h1><?php if($title){ echo $title; } ?></h1><br>
<div class="wite"><?php
$logged_in=$this->session->userdata('logged_in');
if($logged_in['su']=="1"){

?>
<table id="detail">
<tr><td >
<form method="post" action="<?php echo site_url('result/get_report');?>">
Generate PDF report 
<select name="gid">
<option value="0">Select Group</option>
<?php foreach($group_list as $value){ ?>
<option value="<?php echo $value['gid'];?>"><?php echo $value['group_name'];?></option>
<?php } ?>
</select> &nbsp;
<select name="quid">
<option value="0">Select Quiz</option>
<?php foreach($quiz_list as $value){ ?>
<option value="<?php echo $value['quid'];?>"><?php echo $value['quiz_name'];?></option>
<?php } ?>
</select> &nbsp;
<input type="submit" name="generate" value="Generate">

</form>
</td>
</tr>
</table>

<?php
}
?>
<table id="detail">
<tr><td ><form method="post" action="<?php echo site_url('result');?>">
<select name="search_type">
<option value="quiz_result.rid">ID</option>
<option value="users.username">Username</option>
<option value="users.first_name">First Name</option>
<option value="users.last_name">Last Name</option>
<option value="quiz.quiz_name">Quiz Name</option>
<option value="quiz_result.score">Score</option>
<option value="quiz_result.percentage">Percentage</option>
</select>
<input type="text" name="search" value=""> 
<input type="submit" value="Search"></form></td></tr>
</table>

<table id="data_list">
<tr><th>Id</th><th>Username</th><th>First name</th><th>Last name</th><th>Quiz name</th><th>Score</th><th>Percentage</th><th>Result</th><th>View</th></tr>
<?php
if($result==false){
?>
<tr>
<td colspan="5">
No record found!
</td>
</tr>
<?php

}else{
foreach($result as $row){
?>
<tr>
<td><?php echo $row->rid;?></td><td><?php echo $row->username;?></td><td><?php echo $row->first_name;?></td><td><?php echo $row->last_name;?></td><td><?php echo $row->quiz_name;?></td><td><?php echo $row->score;?></td><td><?php echo substr($row->percentage , 0, 5 );?>%</td><td><?php if($row->q_result == "1"){  echo "Pass"; }else{ echo "Fail"; } ?> </td>
<td><a href="<?php echo site_url('result/view/'.$row->rid.'/'.$row->quid);?>">View</a></td>
</tr>
<?php
}
}
?>


</table>
<br>
<?php
if(($limit-($this->config->item('number_of_rows')))>=0){ $back=$limit-($this->config->item('number_of_rows')); }else{ $back='0'; } ?>

<?php
if($logged_in['su']=="1"){
?>
<a href="<?php echo site_url('result/index/'.$back);?>">Back</a>
&nbsp;&nbsp;
<?php
 $next=$limit+($this->config->item('number_of_rows'));  ?>

<a href="<?php echo site_url('result/index/'.$next);?>">Next</a>
<?php
}else{
?>
<a href="<?php echo site_url('result/user/'.$back);?>">Back</a>
&nbsp;&nbsp;
<?php
 $next=$limit+($this->config->item('number_of_rows'));  ?>

<a href="<?php echo site_url('result/user/'.$next);?>">Next</a>
<?php
}
?></div>
</div>
